package com.kindness.frate.utils;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;

/**
 * com.szlanyou.iov.util
 *
 * @author R.W
 * @date create at 2016/12/22
 * @修订 1.修改内容   by 修改人  at 修改日期
 */

public class UIHelper {

    public static void startActivity(Context context, Class cls) {
        Intent intent = new Intent(context, cls);
        context.startActivity(intent);
    }

    public static void startActivityWithData(Context context, Class cls, Bundle data) {
        Intent intent = new Intent(context, cls);

        intent.putExtras(data);

        context.startActivity(intent);
    }


    public static void startActivityForResult(Activity context, Class cls, int requestCode) {
        Intent intent = new Intent(context, cls);

        context.startActivityForResult(intent, requestCode);
    }


    public static void setResultFinish(Activity context, Bundle data, int resultCode) {
        Intent intent = new Intent();

        intent.putExtras(data);
        context.setResult(resultCode, intent);
        context.finish();
    }

    public static void startActivityForResultWithData(Activity context, Class cls, Bundle data, int requestCode) {
        Intent intent = new Intent(context, cls);
        if (null != data){
            intent.putExtras(data);
        }
        context.startActivityForResult(intent, requestCode);
    }
}
